<?php
/*
 * Template Name: Connexion
 */
?>
<?php

$error = false; 
if(!empty($_POST)){
    $user = wp_signon($_POST);
    if(is_wp_error($user)){
        $error = $user->get_error_message(); 
    }else{
        header('location:profil');
    }
}else{
    $user = wp_get_current_user();
    if($user->ID != 0){
        header('location:profil');
    }
}

?>

<?php get_header() ?>

<div class="middle-highlight-container">
	<div class="middle">
    	<h2 class="page-subtitle">Connexion</h2>
  	</div>
</div>

<div id="content-container">

	<div class="formulaire">
		<form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">

			<table border="0" cellspacing="0" cellpadding="0" width="100%">

				<tr>
					<td><label for="user_login">Votre login</label></td>
					<td><input type="text" name="user_login" id="user_login"> </td>
				</tr>

				<tr>
					<td><label for="user_password">Votre mot de passe</label></td>
					<td><input type="password" name="user_password" id="user_password"></td>
				</tr>

				<tr>
					<td></td>
					<td><input type="submit" value="Se connecter"></td>
				</tr>

			</table>

		</form>
	</div>
	

</div>

 <?php get_footer() ?>

